// https://www.acwing.com/problem/content/868/

#include <iostream>
#include <cmath>
using namespace std;

bool judge(int x) {
    if (x < 2) {
        return false;
    }
    int w = sqrt(x);
    for (int t=2; t <= w; t++) {
        if (x % t == 0) {
            return false;
        }
    }
    return true;
}

int main() {
    int n, x;
    scanf("%d", &n);
    for (int i=0; i<n; i++) {
        scanf("%d", &x);
        if (judge(x)) {
            cout<<"Yes"<<endl;
        } else {
            cout<<"No"<<endl;
        }
    }
    return 0;
}
